/*
 * Copyright (c) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef SWANLINK_FINANCE_SERVICES_ICCREADER_SRV_PROXY_H_
#define SWANLINK_FINANCE_SERVICES_ICCREADER_SRV_PROXY_H_

#include "iiccreader_srv.h"
#include "nocopyable.h"
#include "iremote_proxy.h"
#include "cashdevice_proxy.h"

namespace SwanLink {
namespace Finance {
class IccreaderSrvProxy : public IRemoteProxy<IIccreaderSrv>, public CashDeviceSrvProxy {
 public:
    explicit IccreaderSrvProxy(const sptr<IRemoteObject>& impl)
        : IRemoteProxy<IIccreaderSrv>(impl),
        CashDeviceSrvProxy(impl, IIccreaderSrv::GetDescriptor()) {}
    ~IccreaderSrvProxy() = default;
    DISALLOW_COPY_AND_MOVE(IccreaderSrvProxy);

    COMMON_FUNC_DEFINE(CashDeviceSrvProxy)
    
    /**
     * 获取设备信息
     */
    int GetDeviceInfo(int fd,DeviceInfo &devInfo) override;
    /**
     * IO控制
     */
    int IccIOCtrl(int fd,IOType type,int value) override;
    /**
     * cpu命令
     */
    int ApduCommand(int fd,IOType type,int len,uint8_t cmd[],uint8_t cmd_out[]) override;
    /**
     * 寻卡
     */
    int CardSearch(int fd,int timeout,SearchResult *result) override;
    /**
     * 停止寻卡
     */
    int CardStopSearch(int fd) override;
    /**
     * 激活非存储卡
     */
    int RfCardActive(int fd,RfCardInfo &cardInfo) override;
    /**
     * 非存储卡休眠
     */
    int RfCardDormancy(int fd) override;
    /**
     * 扫描数据
     */
    int ScanData(int fd,const DeviceConfig& config,ResultData &result) override;

 private:
    static inline BrokerDelegator<IccreaderSrvProxy> delegator_;
};
} // namespace Finance
} // namespace SwanLink

#endif // SWANLINK_FINANCE_SERVICES_ICCREADER_SRV_PROXY_H_
